// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;

namespace SnapObjects.Data
{
    /// <summary>
    ///     Specifies the column(s) to be used as search condition when the model class is performing updates to the database.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)]
    public class UpdateWhereStrategyAttribute : Attribute, IUpdateWhereStrategy
    {
        /// <summary>
        ///     Initializes a new instance of the UpdateWhereStrategyAttribute class.
        /// </summary>
        /// <param name="strategy">The column(s) that will be included in the WHERE clause of the UPDATE statement.</param>
        public UpdateWhereStrategyAttribute(UpdateWhereStrategy strategy)
        {
            this.UpdateWhereStrategy = strategy;
        }

        /// <summary>
        ///     Gets the strategy that which column(s) will be included in the WHERE clause of the UPDATE statement.
        /// </summary>
        public UpdateWhereStrategy UpdateWhereStrategy { get; }
    }
}
